<!doctype html>
<html>
<head>
	<title>登陆页</title>
	<meta charset="utf-8">
</head>
<body>
	<div data-role="page" class="login_page_beijing">
		<div class="ui-grid-solo">
			<div class="login_logo"><img src="../../css/images/login_logo.png" width="260"></div>
		</div>
		<div class="ui-grid-solo">
			<div class="login_text">
				<div class="login_username"><input name="user_number" type="text" data-role="none" value="" class="login_username_input" id="username" placeholder="请输入登录帐号"/></div>
				<div class="login_paw"><input name="login_password" type="password" id="password"  value="" data-role="none" class="login_username_input" placeholder="请输入登录密码" /></div>
			</div>
		</div>
		<div class="ui-grid-solo">
			<div class="login_tips"></div>
		</div>
		<div class="ui-grid-solo">
			<div class="login_tijiao"><a href="#selectBingqu" id="denglu_tijiao" class="ui-btn" data-rel="popup" data-position-to="window" data-transition="pop">登陆</a></div>
			<div class="login_tijiao" style="border:solid 1px #017db9;border-radius:5px;padding:0px 10px;">
				<table>
					<tr>
						<td>
							<div style="text-align:left;">服务器名称:</div>
						</td>
						<td>
							<div id="server_name" style="text-align:left;"></div>
						</td>
					</tr>
					<tr>
						<td>
							<div style="text-align:left;">服务器地址:</div>
						</td>
						<td>
							<div id="server_url" style="text-align:left;"></div>
						</td>
					</tr>
					<tr>
						<td>
							<div style="text-align:left;">当前版本号:</div>
						</td>
						<td>
							<div id="app_version" style="text-align:left;"></div>
						</td>
					</tr>
				</table>
				<div onClick="window.wst.showIpListDialog()" class="ui-btn" >切换服务器</div>
			</div>
			<div class="login_tijiao">
				<div style="text-align:center;">Copyright 2009-2014@北京天坦软件</div>
			</div>
		</div>
		<div data-role="popup" id="selectBingqu" data-overlay-theme="c" data-theme="c" data-dismissible="false" style="max-width:400px;">
			<div data-role="header" data-theme="a">
			<h1>选择病区</h1>
			</div>
			<div role="main" class="ui-content keshi_list" style="width:300px;padding-left:27px;">
			</div>
		</div>

		<script type="text/javascript">
			$(function(){
				user_operation_auth_sate = false;
				beginCheckUpdate();
				document_type_global = "userlogin";
				document.getElementById("app_version").innerHTML = version_value;
				document.getElementById("server_name").innerHTML = server_name;
				document.getElementById("server_url").innerHTML = host_ip;
				
				$("#denglu_tijiao").die().live('vclick',function(){
					user_number = $("#username").val();
					login_password = $('#password').val();
					if(user_number=='' || login_password=='')
					{
						$(".keshi_list").html('<div style="width:70%; text-align:center">用户登陆信息不正确</div><a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-b" data-rel="back" data-transition="flow" >确定</a>');
						return false;
					}
						
					$.ajax({
						type: "get",
						async: true,
						url:server_url+"Common/System/checkLogin/version/v3/login_password/"+login_password+"/user_number/"+user_number+yiyuan_id,
						data:{},
						dataType: "jsonp",
						jsonp: "callbackCheckLogin",
						jsonpCallback:"feedBackStateCheckLogin",
						error:function(mes)
						{
							alert("请求失败，请稍后重试");
						},
						success: function(result) {
							if(result.ret =="success")
							{
								var str='';
								for(var i=0;i<result.keshi.length;i++)
								{
									str += '<a style="width:70%;margin:10px 0;" data href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-b selectKeshi" data-rel="back" data-transition="flow" user_number="'+result.keshi[i].user_number+'"  user_department="'+result.keshi[i].user_department+'">'+result.keshi[i].user_department+'</a>';
								}
								$(".keshi_list").html(str);
							}
							else
								{
								$(".keshi_list").html('<div style="width:70%; text-align:center">用户登陆信息不正确</div><a href="#" class="ui-btn ui-corner-all ui-shadow ui-btn-b" data-rel="back" data-transition="flow" >确定</a>');
							}
						}
					});
				});
				
				$(".selectKeshi").die().live("click",function(){
					var user_number=$(this).attr('user_number');
					var user_department=$(this).attr('user_department');
					user_login_department = user_department;
					getLogin(user_number,user_department);
				});
			});
			
			function beginCheckUpdate()
			{
				$.ajaxSetup({
					async: false
				});
				$.ajax({
					type: "get",
					async: true,
					url:server_url+"Mobile/System/versionValue"+yiyuan_id,
					data: { type : "123"},
					dataType: "jsonp",
					jsonp: "callbackVersionValue",
					jsonpCallback:"feedBackStateVersionValue",
					error:function(mes)
					{
						alert(mes);
					},
					success: function(result) {
						new_version_value = result.new_verison;
						window.wst.checkUpdate(new_version_value,host_ip);
					}
				});
				$.ajaxSetup({
					async: true
				});
				
			}
			
			function initPationtInfo()
			{
				$.ajax({
					type: "get",
					async: true,
					url:server_url+"Mobile/Patient/getPatientInfoDefaultJson/"+yiyuan_id,
					data: { user_department : nurse_info_global.user_department},
					dataType: "jsonp",
					jsonp: "callbackGetPatientInfoDefaultJson",
					jsonpCallback:"feedBackStateGetPatientInfoDefaultJson",
					error:function(mes)
					{
						alert(mes);
					},
					success: function(result) {
						if(result.ret=="success")
						{
							patient_info_global = result.data;
							setHeader();
						}
						else
						{
							alert("失败");
						}
					}
				});
			}
		</script>
	</div>

</body>
</html>